<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>

    var pwd = "123123";

    var low = /^([0-9_$]{6,12}|[a-z_$]{6,12}|[A-Z_$]{6,12})$/;
    var mid = /^((?=[0-9]*)(?=[a-z]*)[0-9a-z_$]{6,12}|(?=[0-9]*)(?=[A-Z]*)[0-9A-Z_$]{6,12}|(?=[A-Z]*)(?=[a-z]*)[a-zA-Z_$]{6,12})$/;
    var high = /^(?=[0-9]*)(?=[a-z]*)(?=[A-Z]*)[\w$]{6,12}$/;

    console.log("弱", low.test(pwd));
    console.log("中", mid.test(pwd));
    console.log("强", high.test(pwd));

    // var level = 0;
    // if (low.test(pwd)) {
    //     level = 1;
    // } else if (mid.test(pwd)) {
    //     level = 2;
    // } else if (high.test(pwd)) {
    //     level = 3;
    // }

    // level = /[_$]/.test(pwd) ? level + 1 : level;


    // console.log(level);






</script>

</html>